package object;

/**
 * 实例内部类
 * @author galen 
 */
public class Outer {
    public int a = 100;
    static int b = 100;
    final  int c = 100;
    private int d = 100;

    public String method1() {
        return "实例方法1";
    }

    public static String method2() {
        return "静态方法2";
    }

    class Inner {
        int a2 = a + 1; // 访问public的a
        int b2 = b + 1; // 访问static的b
        int c2 = c + 1; // 访问final的c
        int d2 = d + 1; // 访问private的d

        String str1 = method1(); // 访问实例方法method1
        String str2 = method2(); // 访问静态方法method2
    }

    public static void main(String[] args) {
        Inner i = new Outer().new Inner();
        System.out.println(i.a2);
        System.out.println(i.b2);
        System.out.println(i.c2);
        System.out.println(i.d2);

        System.out.println(i.str1);
        System.out.println(i.str2);
    }
}
